from models import CSS, JS
import settings

from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext, TemplateDoesNotExist
from django.http import HttpResponse, Http404

def css(request, path):
    """
    Render a css file object.
    """
    obj = get_object_or_404(CSS, path=path)
    str = obj.render()
    response = HttpResponse(str)
    response['Content-Type'] = 'text/css'
    return response

def js(request, path):
    """
    Render a javascript file object.
    """
    obj = get_object_or_404(JS, path=path)
    str = obj.render()
    response = HttpResponse(str)
    response['Content-Type'] = 'text/javascript'
    return response
